import { createApp } from "vue";
import { ElIcon } from 'element-plus';

import { i18n } from "./lang/index";
import { Toast, ImagePreview, Icon ,SwipeCell,SubmitBar,CountDown,NavBar  } from "vant";
import "vant/es/toast/style";

import App from "./App.vue";
import router from "./router";

import VueLazyLoad from "vue-lazyload";

import { createPinia } from "pinia";
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import "vant/lib/index.css";
import "./style.css";
import "./assets/js/pi-sdk.js";
// import "./assets/js/checkout.js";

// Socket.io配置
import VueSocketIO from "vue-3-socket.io";
import SocketIO from "socket.io-client";
// const socketio = new VueSocketIO({
//     debug: false,
//     connection: SocketIO("https://chat.pipayshop.com", {
//         transports: ["websocket"],
//     }),
//     extraHeaders: { "Access-Control-Allow-Origin": "*" },
//     options: {
//         autoConnect: false,
//     },
// });
const socketio=null
const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);

const app = createApp(App);
//vant
app.use(ImagePreview);
app.use(CountDown);
app.use(Icon,SwipeCell,SubmitBar);
app.use(Toast);
app.use(NavBar);
app.use(ElementPlus)
// app.use(socketio);
app.use(pinia);
app.use(router);
app.use(i18n);
app.use(VueLazyLoad, {
    error: "/images/error.svg", // 加载错误的图片
    loading: "/images/loading3.gif", // 加载时的图片
});
app.component('ElIcon', ElIcon); // 注册组件
app.mount("#app");
// app.use(VueMasonryPlugin);